package com.smart.common.util;

import com.smart.vo.UserVo;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;

public class SysUserUtils {
	
	public static UserVo getSysUser() {
        try {
            SecurityContext ctx = SecurityContextHolder.getContext();
            Authentication auth = ctx.getAuthentication();
            SysUserDetails memberDetails = (SysUserDetails) auth.getPrincipal();
            return memberDetails.getInfoVo();
        } catch (Exception e) {
            return new UserVo();
        }
    }
	
}